package iscript.uiFramework.util 
{
	/**
	 * ...
	 * @author ...
	 */
	public class NumberUtil 
	{
		
		/**
		 * 修正浮点数
		 * @param	value
		 * @return
		 */
		static  public function FloatNumer(value:Number):Number
		{
			var m:Number = value;
			var result:Number = m - int(m);
			if (result < 1e-5)
				return Math.round(value);
			var pos_9:int = int.MAX_VALUE;
			var pos_0:int = int.MAX_VALUE;
			var sequenceStr_9:String = (result).toString();
			var sequenceStr_0:String = (result).toString();
			var reg9:RegExp = new RegExp(/9{5,}/);
			var reg0:RegExp = new RegExp(/0{5,}/);
			if (reg9.test(sequenceStr_9))
			{
				pos_9 = sequenceStr_9.search(reg9);
				if (pos_9 == -1)
					pos_9 = int.MAX_VALUE;
			}
			if (reg0.test(sequenceStr_0))
			{
				pos_0 = sequenceStr_0.search(reg0);
				if (pos_0 == -1)
					pos_0 = int.MAX_VALUE;
			}
			if (pos_0 == pos_9)
			{
				return value;
			}
			else
			{
				if (pos_9 < pos_0)
				{
					var carry:Number = Math.pow(10, -1 * (pos_9 -
						
						1));
					var str_9:String = String(m).substring(0, pos_9 +
						
						1);
					var num_9:Number = Number(Number(Number(str_9) +
						
						carry).toFixed(pos_9 - 1));
					return num_9;
				}
				else
				{
					var str_0:String = String(m).substring(0, pos_0);
					var num_0:Number = Number(str_0);
					return num_0;
				}
			}
		}
		
	}

}